package forces;

import physicalobjects.Mass;

/**
 * Creates a gravity force.
 *
 * @author Kathleen Lan, Seon Kang
 */

public class Gravity extends Force {

    private static double ourDEFAULTMAGNITUDE = 1;
    private static final double DEFAULTANGLE = 90;
    private double myAngle;
 // either equal to DEFAULT_MAGNITUDE or
    // magnitude inputed from Environmental data
    // file
 // current magnitude (equals 0 when
    // CenterOfMass is toggled off,
    private String myForceName = "gravity";
    /**
     *
     */
    public Gravity () {
        super(DEFAULTANGLE, ourDEFAULTMAGNITUDE);
        myAngle = DEFAULTANGLE;
        setMyName(myForceName);
    }

    /**
     * @param angle 
     * @param magnitude 
     */
    public Gravity (double angle, double magnitude) {
        super(DEFAULTANGLE, ourDEFAULTMAGNITUDE);
        myAngle = angle;
        setMyName(myForceName);
    }

    @Override
    public void update (Mass m) {
        setDirection(myAngle);
        setMagnitude(getMagnitude());
        m.applyForce(this);
    }

}
